Skip to content

Effects keyed on unstable identities (#66, Part 4) - #69

Merged
n4ff4h merged 6 commits into
devfrom
fix/66-part4-stable-effects
Nov 18, 2026
Merged

n4ff4h merged 6 commits into
devfrom
fix/66-part4-stable-effects

Conversation

@n4ff4h

@n4ff4h n4ff4h commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

Fixes Part 4 of #66 (effects keyed on unstable identities). Each item has a test that failed before its fix.

Item Change
4.1 useListingState compares paramNames by value, and onValueChange runs only when the listing state actually changes. Before, it ran on every render with an inline paramNames, and once on mount under StrictMode. (e86440b)
4.2 SignaturePad reads t from a ref, so a new translator (a language switch, or an inline maps={{…}} on OnuProvider) no longer rebuilds the pad and wipes the drawing while the hidden input still holds the old signature. SignaturePad items from 8.5 are left alone. (5273494)
4.3 Editors (_use-editor.ts): a rebuilt Tiptap editor (for example after thaana is toggled) now starts from what the editor currently holds, not from defaultValue. The placeholder is read through a ref and redrawn when its text changes, so it follows the locale. A function placeholder (BlockEditor passes one inline) is compared by what it returns. (f446b09)
4.5 useMergedRef returns a React 19 ref callback with a cleanup. A ref that returns a cleanup now has it called on detach, instead of being called again with null. (a352a06)
4.5 (grep) Form and ValidationSummary merged their forwarded ref by hand in an inline callback. The forwarded ref was detached and reattached on every render, and its cleanup was dropped. Both now use useMergedRef. Each has its own failing test. (d1c0b28, 2b14969)

Skipped ([P] / device check)

  • 4.4 LoadMore auto mode with an inline onLoadMore ([P], needs a real IntersectionObserver).

Could not reproduce

  • None.

Grep for the same pattern

  • t in hook deps: charts/format.ts, inputs/phone-input.tsx, listing/_dnd.tsx, editor/block-renderer.tsx and media/media-player.tsx are useMemos that should recompute when the translation changes. The effects in listing/data-table.tsx and listing/filter-panel.tsx already check a last-value ref, so a new t doesn't make them announce again. I left these as they are.
  • Callback props in effect deps: ui/carousel.tsx (its onSelect is an internal useCallback) and charts/_map-chart-google.tsx (it only rebuilds the deck.gl layer). Neither showed a bug I could test. listing/load-more.tsx is 4.4 ([P]).
  • Hand-written ref merges: Form and ValidationSummary were the only ones. Both are fixed above.

Behaviour notes

  • useMergedRef's callback now returns a cleanup function. It still handles being called with null by older ref composers.
  • useListingState no longer calls onValueChange when nothing changed. It still writes the URL whenever the state or URL options change.

Verification

  • pnpm lint && pnpm format:check && pnpm typecheck: pass
  • pnpm --filter @javaabu/onu exec vitest run --maxWorkers=3: 197 files, 2867 passed, 1 skipped
  • node scripts/check-docs.mjs: Docs OK
  • pnpm build && pnpm --filter @javaabu/onu size: pass, no budget changes

🤖 Generated with Claude Code

agent and others added 6 commits November 18, 2026 05:15
… 4.1)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… 4.2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eholder (#66, 4.3)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@n4ff4h
n4ff4h merged commit a57916d into dev Nov 18, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant